
<template>
  <!-- 导航 -->
  <van-nav-bar
    title="订单评价"
    left-text="返回"
    left-arrow
    @click-left="back"
  ></van-nav-bar>

  <section class="aui-flexView">
    <!-- 订单详细 -->
    <section class="aui-scrollView">
      <!-- 订单状态 -->
      <div class="aui-pay-change">
        <div class="aui-flex">
          <div class="aui-flex-box">
            <h3>{{ info.order.status_text }}</h3>
          </div>
          <div class="aui-pay-zfb">
            <img src="/assets/images/icon-zfb.png" alt="" />
          </div>
        </div>
      </div>

      <!-- 订单商品 -->
      <div class="aui-commodity-bg">
        <div
          v-for="(product, index) in info.product"
          :key="index"
          style="padding-bottom: 10px"
        >
          <div class="aui-flex">
            <div class="aui-commodity-img">
              <img
                @click="ToProduct(product.proid)"
                :data-proid="product.proid"
                :src="product.info.cover_cdn"
              />
            </div>
            <div class="aui-flex-box">
              <h4>{{ product.info.name }}</h4>
              <p>商品单价：￥{{ product.price }}</p>
              <span class="aui-barter-time">七天退换</span>
            </div>
            <div>
              <h5>￥{{ product.total }}</h5>
              <p class="aui-sml-text">X{{ product.nums }}</p>
            </div>
          </div>
          <div style="padding: 15px">
            <van-rate v-model="product.rate" readonly />
          </div>
          <div>
            <van-cell-group inset>
              <van-field
                v-model="product.comment"
                rows="2"
                autosize
                label="评价"
                type="textarea"
                readonly
              />
            </van-cell-group>
          </div>
          <div style="padding: 15px">
            <van-image
              v-for="(item, index) in product.proimg_cdn" :key="index"
              width="5rem"
              style="margin-right:1rem;"
              height="5rem"
              fit="cover"
              :src="item"
              @click="changeImg(item)"
            />
          </div>
        </div>
      </div>
    </section>
  </section>
</template>
<script>
import { ImagePreview } from 'vant';
export default {
  emits: ["toggle"],
  created() {
    this.$emit("toggle", false);

    this.orderInfo();
  },
  data() {
    return {
      orderid: this.$route.query.orderid ? this.$route.query.orderid : 0,
      info: {
        order: {},
        product: {},
      },
      LoginUser: this.$cookies.get("LoginUser"),
    };
  },
  methods: {
    back() {
      this.$router.go(-1);
    },
    changeImg(val){
        ImagePreview([val]);
    },
    async orderInfo() {
      var data = {
        userid: this.LoginUser.id,
        orderid: this.orderid,
      };

      var result = await this.$api.orderInfo(data);

      if (result.code == 0) {
        //购物车数据请求失败
        this.$notify({
          message: result.msg,
          duration: 1000,
        });
      }

      this.info = result.data;
      // console.log(this.info)
    },
    ToProduct(id) {
      this.$router.push({
        path: "/product/product/info",
        query: { proid: id },
      });
    },
  },
};
</script>

<style scoped>
  .preview-cover {
    position: absolute;
    bottom: 0;
    box-sizing: border-box;
    width: 100%;
    padding: 4px;
    color: #fff;
    font-size: 12px;
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
  }
.divHeight {
  width: 100%;
  height: 10px;
  background: #f5f5f5;
  position: relative;
  /* overflow: hidden; */
}

.r-line {
  position: relative;
}

.r-line:after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 0;
  right: 0;
  height: 100%;
  border-right: 1px solid #d9d9d9;
  -webkit-transform: scaleX(0.5);
  transform: scaleX(0.5);
  -webkit-transform-origin: 100% 0;
  transform-origin: 100% 0;
}

.b-line {
  position: relative;
}

.b-line:after {
  content: "";
  position: absolute;
  z-index: 2;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  border-bottom: 1px solid #e2e2e2;
  -webkit-transform: scaleY(0.5);
  transform: scaleY(0.5);
  -webkit-transform-origin: 0 100%;
  transform-origin: 0 100%;
}

.aui-flex {
  display: -webkit-box;
  display: -webkit-flex;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  align-items: center;
  padding: 15px;
  position: relative;
}

.aui-flex-box {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  flex: 1;
  min-width: 0;
  font-size: 13px;
  color: #333;
  /* width: 100%; */
}

/* 必要布局样式css */
.aui-flexView {
  width: 100%;
  height: 100%;
  margin: 0 auto;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
}

.aui-scrollView {
  width: 100%;
  height: 100%;
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  -ms-flex: 1;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  position: relative;
  margin-top: 0;
}

.aui-navBar {
  height: 44px;
  position: relative;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  z-index: 1002;
  background: #f7f6f6;
}

.aui-navBar-item {
  height: 44px;
  min-width: 35%;
  -webkit-box-flex: 0;
  -webkit-flex: 0 0 35%;
  -ms-flex: 0 0 35%;
  flex: 0 0 35%;
  padding: 0 0.9rem;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  color: #353535;
  position: relative;
}

.aui-navBar-item:first-child {
  -webkit-box-ordinal-group: 2;
  -webkit-order: 1;
  -ms-flex-order: 1;
  order: 1;
  margin-right: -25%;
  font-size: 0.9rem;
  font-weight: bold;
  color: #717171;
}

.aui-navBar-item:last-child {
  -webkit-box-ordinal-group: 4;
  -webkit-order: 3;
  -ms-flex-order: 3;
  order: 3;
  -webkit-box-pack: end;
  -webkit-justify-content: flex-end;
  -ms-flex-pack: end;
  justify-content: flex-end;
}

.aui-center {
  -webkit-box-ordinal-group: 3;
  -webkit-order: 2;
  -ms-flex-order: 2;
  order: 2;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  height: 44px;
  width: 50%;
  margin-left: 25%;
}

.aui-center-title {
  text-align: center;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  display: block;
  text-overflow: ellipsis;
  font-size: 0.95rem;
  color: #333;
}

.icon {
  width: 20px;
  height: 20px;
  display: block;
  border: none;
  float: left;
  background-size: 20px;
  background-repeat: no-repeat;
}

.icon-return {
  background-image: url("");
}

.icon-more {
  background-image: url("");
}

.aui-pay-change {
  /* height: 120px; */
  background-image: -webkit-gradient(
    linear,
    left top,
    right top,
    from(#ff9000),
    to(#ff5101)
  );
  background-image: -webkit-linear-gradient(left, #ff9000, #ff5101);
  background-image: -moz-linear-gradient(left, #ff9000, #ff5101);
  background-image: linear-gradient(to right, #ff9000, #ff5101);
  background-color: #ff5101;
  /* margin-bottom: 20px; */
}

.aui-pay-zfb {
  width: 100px;
}

.aui-pay-zfb img {
  width: 100%;
  height: auto;
  display: block;
  border: none;
}

.aui-pay-change .aui-flex {
  padding: 20px 30px;
  color: #fff;
}

.aui-pay-change .aui-flex-box {
  color: #fff;
}

.aui-flex-add {
  width: 40px;
  height: 40px;
  margin-right: 10px;
}

.aui-flex-add img {
  width: 100%;
  height: auto;
  display: block;
  border: none;
}

.aui-flex-box h3 {
  /* padding-bottom:10px; */
}

.aui-flex-box h3 em {
  font-size: 14px;
  color: #999;
  font-style: normal;
  font-weight: normal;
}

.aui-shop-item {
  width: 25px;
  height: 25px;
  margin-right: 5px;
}

.aui-shop-item img {
  width: 100%;
  height: auto;
  display: block;
  border: none;
}

.aui-shop-item-arrow {
  position: relative;
  font-size: 14px;
  color: #333;
}

.aui-shop-item-arrow:after {
  content: " ";
  display: inline-block;
  height: 8px;
  width: 8px;
  border-width: 2px 2px 0 0;
  border-color: #949494;
  border-style: solid;
  -webkit-transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
  transform: matrix(0.71, 0.71, -0.71, 0.71, 0, 0);
  position: relative;
  top: -2px;
  position: absolute;
  top: 50%;
  margin-top: -4px;
  right: -13px;
  border-radius: 1px;
}

.aui-commodity-bg {
  background: #f5f5f5;
}

.aui-commodity-img {
  width: 85px;
  height: 85px;
  margin-right: 5px;
}

.aui-commodity-img img {
  width: 100%;
  height: auto;
  display: block;
  border: none;
}

.aui-barter-time {
  border: 1px solid #ff5306;
  color: #ff5306;
  font-size: 13px;
  border-radius: 3px;
  background: #fff1ec;
  padding: 2px 5px;
}

.aui-commodity-bg .aui-flex {
  -webkit-box-align: initial;
  -webkit-align-items: initial;
  align-items: initial;
}

.aui-flex-box p {
  font-size: 12px;
  color: #999;
  padding: 5px 0;
}

.aui-pay-change .aui-flex-box p {
  color: #fff;
}

.aui-insurance-img {
  width: 25px;
  height: 25px;
  margin-right: 5px;
}

.aui-insurance-img img {
  width: 100%;
  height: auto;
  display: block;
  border: none;
}

.aui-insurance-box .aui-flex-box h5 {
  color: #999999;
}

.aui-sml-text {
  font-size: 12px;
  padding-top: 5px;
}

.aui-flex-ed em {
  float: right;
  font-style: normal;
  color: #999999;
}

.aui-cp-edu {
  position: relative;
  padding: 10px 15px;
}

.aui-cp-edu .aui-flex {
  padding: 2px 0;
  color: #999;
}

.aui-cp-edu .aui-flex-box {
  color: #999;
}

.aui-san-sml {
  position: absolute;
  bottom: 0;
  right: 27px;
  width: 0;
  border-right: 10px solid transparent;
  border-left: 10px solid transparent;
  border-bottom: 10px solid #e5e5e5;
}

.aui-flex-text-sml p {
  color: #666666;
  font-size: 12px;
}

.aui-flex-text-sml p em {
  font-style: normal;
  padding-right: 5px;
}

.aui-btn-copy {
  border: 1px solid #ddd;
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 2px;
}

.aui-confirm-flex {
  position: relative;
  line-height: 40px;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
}

.aui-confirm-flex .aui-modify-btn {
  position: relative;
  text-align: center;
  display: block;
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  -ms-flex: 1;
  flex: 1;
  padding: 0 2px;
  font-size: 0.8rem;
  color: #191919;
  height: 45px;
  line-height: 45px;
}

.aui-confirm-flex > a:not(:last-child):after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 10px;
  right: 0;
  height: 50%;
  border-right: 1px solid #b3b3b3;
  -webkit-transform: scaleX(0.5);
  transform: scaleX(0.5);
  -webkit-transform-origin: 100% 0;
  transform-origin: 100% 0;
}

.icon-kf {
  top: 13px;
  left: 40px;
  position: absolute;
  background-image: url("");
}

.icon-dh {
  position: absolute;
  background-image: url("");
  top: 13px;
  left: 40px;
}

.aui-like {
  width: 100%;
}

.aui-like img {
  width: 100%;
  height: auto;
  display: block;
  border: none;
}

/* shop list */
.aui-shop-list {
  position: relative;
  overflow: hidden;
  padding-left: 10px;
  background: #f2f2f2;
  padding-bottom: 50px;
}

.aui-shop-list-item {
  width: 48%;
  float: left;
  position: relative;
  z-index: 0;
  /* padding: 0.32rem 0; */
  font-size: 0.28rem;
  margin-right: 2%;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
}

.aui-shop-list-item-hd {
  position: relative;
}

.aui-shop-list-item-hd img {
  width: 100%;
  height: auto;
  display: block;
  border: none;
}

.aui-shop-list-item-bd {
  text-align: center;
  font-size: 0.9rem;
  color: #333;
  padding: 10px;
  font-weight: bold;
}

.aui-shop-list-selected .aui-shop-list-item h3 {
  color: #333;
  font-size: 0.8rem;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-weight: normal;
  text-align: left;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.aui-shop-list-selected .aui-special-text {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  font-weight: normal;
}

.aui-shop-list-selected .aui-special-etc {
  color: #ff5000;
  font-weight: inherit;
  /* padding-top: 10px; */
  font-size: 16px;
  text-align: left;
}

.aui-shop-list-selected .aui-special-etc .aui-special-etc-bd {
  text-decoration: line-through;
  color: #999;
  font-weight: normal;
  font-size: 0.7rem;
}

.aui-shop-list-selected .aui-special-text em {
  color: #eb2745;
  font-size: 0.65rem;
  border-radius: 20px;
  border: 1px solid #eb2745;
  font-style: normal;
  padding: 0 0.4rem;
  margin-right: 2px;
}

.aui-shop-list-selected .aui-special-text span {
  color: #999;
  font-weight: normal;
  font-size: 0.65rem;
}

.aui-footer {
  width: 100%;
  position: relative;
  z-index: 100;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  padding: 7px 5px 7px 5px;
  background: #ffffff;
}

.aui-footer:after {
  content: "";
  position: absolute;
  z-index: 0;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  border-top: 1px solid #bbbbbb;
  -webkit-transform: scaleY(0.5);
  transform: scaleY(0.5);
  -webkit-transform-origin: 0 100%;
  transform-origin: 0 100%;
}

.aui-tabBar-item {
  -webkit-box-flex: 1;
  -webkit-flex: 1;
  -ms-flex: 1;
  flex: 1;
  display: -webkit-box;
  display: -webkit-flex;
  display: -ms-flexbox;
  display: flex;
  -webkit-box-orient: vertical;
  -webkit-box-direction: normal;
  -webkit-flex-direction: column;
  -ms-flex-direction: column;
  flex-direction: column;
  -webkit-box-pack: center;
  -webkit-justify-content: center;
  -ms-flex-pack: center;
  justify-content: center;
  -webkit-box-align: center;
  -webkit-align-items: center;
  -ms-flex-align: center;
  align-items: center;
  color: #979797;
}

.aui-tabBar-item-text {
  display: inline-block;
  font-size: 0.65rem;
  color: #757980;
  padding-top: 2px;
}

.aui-tabBar-item-active .aui-tabBar-item-text {
  color: #fe3542;
}

.aui-footer-fixed {
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 49;
}

.aui-footer-text-info {
  width: 100%;
  text-align: right;
  padding: 10px 0;
}

.aui-footer-text-info a {
  border: 1px solid #d6d6d6;
  color: #666666;
  font-size: 12px;
  border-radius: 20px;
  padding: 3px 10px;
  margin: 0 4px;
}

.aui-footer-text-info .aui-payment {
  border-color: #ff5500;
  color: #ff5500;
}

.aui-special-etc em {
  float: right;
}

.icon-sm-more {
  background-image: url("");
}

.orderinfo {
  padding-bottom: 5em;
}
</style>